.class Lcom/instagram/creation/video/d/f;
.super Lcom/instagram/creation/video/d/d;
.source "MediaPlayerManager.java"


# instance fields
.field final synthetic b:Lcom/instagram/creation/video/d/e;

.field private c:Lcom/instagram/creation/video/h/h;

.field private d:Lcom/instagram/creation/video/i/a;


# direct methods
.method public constructor <init>(Lcom/instagram/creation/video/d/e;Lcom/instagram/creation/video/gl/l;Lcom/instagram/creation/video/i/a;)V
    .locals 2
    .parameter
    .parameter
    .parameter

    .prologue
    .line 436
    iput-object p1, p0, Lcom/instagram/creation/video/d/f;->b:Lcom/instagram/creation/video/d/e;

    .line 437
    invoke-direct {p0, p1, p2}, Lcom/instagram/creation/video/d/d;-><init>(Lcom/instagram/creation/video/d/a;Lcom/instagram/creation/video/gl/l;)V

    .line 438
    new-instance v0, Lcom/instagram/creation/video/h/h;

    const/4 v1, 0x1

    invoke-direct {v0, v1}, Lcom/instagram/creation/video/h/h;-><init>(I)V

    iput-object v0, p0, Lcom/instagram/creation/video/d/f;->c:Lcom/instagram/creation/video/h/h;

    .line 439
    iput-object p3, p0, Lcom/instagram/creation/video/d/f;->d:Lcom/instagram/creation/video/i/a;

    .line 440
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->c:Lcom/instagram/creation/video/h/h;

    invoke-virtual {p2, v0}, Lcom/instagram/creation/video/gl/l;->a(Lcom/instagram/creation/video/gl/a;)V

    .line 441
    return-void
.end method

.method private h()V
    .locals 5

    .prologue
    .line 485
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->b:Lcom/instagram/creation/video/d/e;

    iget-object v1, v0, Lcom/instagram/creation/video/d/e;->a:Ljava/lang/Object;

    monitor-enter v1

    .line 486
    :try_start_0
    const-string v0, "MediaPlayerManager"

    const-string v2, "Preparing Media Players"

    invoke-static {v0, v2}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 487
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->b:Lcom/instagram/creation/video/d/e;

    invoke-static {v0}, Lcom/instagram/creation/video/d/e;->a(Lcom/instagram/creation/video/d/e;)Landroid/media/MediaPlayer;

    move-result-object v0

    new-instance v2, Landroid/view/Surface;

    iget-object v3, p0, Lcom/instagram/creation/video/d/f;->c:Lcom/instagram/creation/video/h/h;

    const/4 v4, 0x0

    invoke-virtual {v3, v4}, Lcom/instagram/creation/video/h/h;->c(I)Landroid/graphics/SurfaceTexture;

    move-result-object v3

    invoke-direct {v2, v3}, Landroid/view/Surface;-><init>(Landroid/graphics/SurfaceTexture;)V

    invoke-virtual {v0, v2}, Landroid/media/MediaPlayer;->setSurface(Landroid/view/Surface;)V

    .line 488
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->c:Lcom/instagram/creation/video/h/h;

    const/4 v2, 0x0

    invoke-virtual {v0, v2}, Lcom/instagram/creation/video/h/h;->c(I)Landroid/graphics/SurfaceTexture;

    move-result-object v0

    iget-object v2, p0, Lcom/instagram/creation/video/d/f;->b:Lcom/instagram/creation/video/d/e;

    invoke-virtual {v0, v2}, Landroid/graphics/SurfaceTexture;->setOnFrameAvailableListener(Landroid/graphics/SurfaceTexture$OnFrameAvailableListener;)V

    .line 490
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->b:Lcom/instagram/creation/video/d/e;

    invoke-static {v0}, Lcom/instagram/creation/video/d/e;->a(Lcom/instagram/creation/video/d/e;)Landroid/media/MediaPlayer;

    move-result-object v0

    iget-object v2, p0, Lcom/instagram/creation/video/d/f;->b:Lcom/instagram/creation/video/d/e;

    invoke-virtual {v0, v2}, Landroid/media/MediaPlayer;->setOnSeekCompleteListener(Landroid/media/MediaPlayer$OnSeekCompleteListener;)V

    .line 491
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->b:Lcom/instagram/creation/video/d/e;

    invoke-static {v0}, Lcom/instagram/creation/video/d/e;->a(Lcom/instagram/creation/video/d/e;)Landroid/media/MediaPlayer;

    move-result-object v0

    const/4 v2, 0x0

    const/4 v3, 0x0

    invoke-virtual {v0, v2, v3}, Landroid/media/MediaPlayer;->setVolume(FF)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 495
    :try_start_1
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->b:Lcom/instagram/creation/video/d/e;

    invoke-static {v0}, Lcom/instagram/creation/video/d/e;->a(Lcom/instagram/creation/video/d/e;)Landroid/media/MediaPlayer;

    move-result-object v0

    invoke-virtual {v0}, Landroid/media/MediaPlayer;->prepare()V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0

    .line 500
    :goto_0
    :try_start_2
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->b:Lcom/instagram/creation/video/d/e;

    const/4 v2, 0x1

    invoke-static {v0, v2}, Lcom/instagram/creation/video/d/e;->a(Lcom/instagram/creation/video/d/e;Z)Z

    .line 501
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->b:Lcom/instagram/creation/video/d/e;

    const/4 v2, 0x1

    iput-boolean v2, v0, Lcom/instagram/creation/video/d/e;->b:Z

    .line 502
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->b:Lcom/instagram/creation/video/d/e;

    const/4 v2, 0x0

    invoke-static {v0, v2}, Lcom/instagram/creation/video/d/e;->b(Lcom/instagram/creation/video/d/e;Z)Z

    .line 503
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->b:Lcom/instagram/creation/video/d/e;

    const/4 v2, 0x0

    invoke-static {v0, v2}, Lcom/instagram/creation/video/d/e;->c(Lcom/instagram/creation/video/d/e;Z)Z

    .line 504
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->b:Lcom/instagram/creation/video/d/e;

    const/4 v2, -0x1

    invoke-static {v0, v2}, Lcom/instagram/creation/video/d/e;->a(Lcom/instagram/creation/video/d/e;I)I

    .line 505
    monitor-exit v1
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    .line 507
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->b:Lcom/instagram/creation/video/d/e;

    iget-object v0, v0, Lcom/instagram/creation/video/d/e;->c:Landroid/os/Handler;

    new-instance v1, Lcom/instagram/creation/video/d/h;

    invoke-direct {v1, p0}, Lcom/instagram/creation/video/d/h;-><init>(Lcom/instagram/creation/video/d/f;)V

    invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    .line 513
    return-void

    .line 497
    :catch_0
    move-exception v0

    .line 498
    :try_start_3
    const-string v2, "MediaPlayerManager"

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "Error during prepare: "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v0}, Ljava/io/IOException;->getMessage()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v2, v0}, Lcom/facebook/e/a/a;->e(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_0

    .line 505
    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_3
    .catchall {:try_start_3 .. :try_end_3} :catchall_0

    throw v0
.end method

.method private i()V
    .locals 3

    .prologue
    .line 516
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->b:Lcom/instagram/creation/video/d/e;

    iget-object v1, v0, Lcom/instagram/creation/video/d/e;->a:Ljava/lang/Object;

    monitor-enter v1

    .line 517
    :try_start_0
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->b:Lcom/instagram/creation/video/d/e;

    iget-boolean v0, v0, Lcom/instagram/creation/video/d/e;->b:Z

    if-nez v0, :cond_0

    .line 518
    monitor-exit v1

    .line 528
    :goto_0
    return-void

    .line 521
    :cond_0
    const-string v0, "MediaPlayerManager"

    const-string v2, "Releasing Media Players"

    invoke-static {v0, v2}, Lcom/facebook/e/a/a;->b(Ljava/lang/String;Ljava/lang/String;)V

    .line 522
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->b:Lcom/instagram/creation/video/d/e;

    const/4 v2, 0x0

    iput-boolean v2, v0, Lcom/instagram/creation/video/d/e;->b:Z

    .line 523
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->b:Lcom/instagram/creation/video/d/e;

    invoke-static {v0}, Lcom/instagram/creation/video/d/e;->a(Lcom/instagram/creation/video/d/e;)Landroid/media/MediaPlayer;

    move-result-object v0

    if-eqz v0, :cond_1

    .line 524
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->b:Lcom/instagram/creation/video/d/e;

    invoke-static {v0}, Lcom/instagram/creation/video/d/e;->a(Lcom/instagram/creation/video/d/e;)Landroid/media/MediaPlayer;

    move-result-object v0

    invoke-virtual {v0}, Landroid/media/MediaPlayer;->release()V

    .line 526
    :cond_1
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->b:Lcom/instagram/creation/video/d/e;

    const/4 v2, 0x0

    invoke-static {v0, v2}, Lcom/instagram/creation/video/d/e;->a(Lcom/instagram/creation/video/d/e;Landroid/media/MediaPlayer;)Landroid/media/MediaPlayer;

    .line 527
    monitor-exit v1

    goto :goto_0

    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method


# virtual methods
.method public a()Lcom/instagram/creation/video/h/h;
    .locals 1

    .prologue
    .line 445
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->c:Lcom/instagram/creation/video/h/h;

    return-object v0
.end method

.method public b()V
    .locals 2

    .prologue
    .line 450
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->d:Lcom/instagram/creation/video/i/a;

    invoke-interface {v0}, Lcom/instagram/creation/video/i/a;->i()V

    .line 451
    invoke-virtual {p0}, Lcom/instagram/creation/video/d/f;->l()Lcom/instagram/creation/video/gl/l;

    move-result-object v0

    sget-object v1, Lcom/instagram/creation/video/gl/q;->b:Lcom/instagram/creation/video/gl/q;

    invoke-virtual {v0, v1}, Lcom/instagram/creation/video/gl/l;->a(Lcom/instagram/creation/video/gl/q;)V

    .line 452
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->b:Lcom/instagram/creation/video/d/e;

    invoke-virtual {v0}, Lcom/instagram/creation/video/d/e;->t()V

    .line 453
    invoke-direct {p0}, Lcom/instagram/creation/video/d/f;->h()V

    .line 454
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->c:Lcom/instagram/creation/video/h/h;

    iget-object v1, p0, Lcom/instagram/creation/video/d/f;->b:Lcom/instagram/creation/video/d/e;

    iget-object v1, v1, Lcom/instagram/creation/video/d/e;->e:Lcom/instagram/pendingmedia/model/a;

    invoke-virtual {v0, v1}, Lcom/instagram/creation/video/h/h;->b(Lcom/instagram/pendingmedia/model/a;)V

    .line 455
    return-void
.end method

.method public c()V
    .locals 0

    .prologue
    .line 459
    invoke-direct {p0}, Lcom/instagram/creation/video/d/f;->i()V

    .line 460
    return-void
.end method

.method public d()V
    .locals 2

    .prologue
    .line 464
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->b:Lcom/instagram/creation/video/d/e;

    invoke-virtual {v0}, Lcom/instagram/creation/video/d/e;->t()V

    .line 465
    invoke-direct {p0}, Lcom/instagram/creation/video/d/f;->h()V

    .line 466
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->b:Lcom/instagram/creation/video/d/e;

    iget-object v0, v0, Lcom/instagram/creation/video/d/e;->c:Landroid/os/Handler;

    new-instance v1, Lcom/instagram/creation/video/d/g;

    invoke-direct {v1, p0}, Lcom/instagram/creation/video/d/g;-><init>(Lcom/instagram/creation/video/d/f;)V

    invoke-virtual {v0, v1}, Landroid/os/Handler;->post(Ljava/lang/Runnable;)Z

    .line 472
    return-void
.end method

.method public e()V
    .locals 2

    .prologue
    .line 476
    iget-object v0, p0, Lcom/instagram/creation/video/d/f;->c:Lcom/instagram/creation/video/h/h;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Lcom/instagram/creation/video/h/h;->a(Z)V

    .line 477
    return-void
.end method

.method public f()V
    .locals 0

    .prologue
    .line 481
    invoke-direct {p0}, Lcom/instagram/creation/video/d/f;->i()V

    .line 482
    return-void
.end method
